import 'package:tender_flutter/page/home/model/app_version_entity.dart';

appVersionEntityFromJson(AppVersionEntity data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	if (json['data'] != null) {
		data.data = new AppVersionData().fromJson(json['data']);
	}
	return data;
}

Map<String, dynamic> appVersionEntityToJson(AppVersionEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	return data;
}

appVersionDataFromJson(AppVersionData data, Map<String, dynamic> json) {
	if (json['url'] != null) {
		data.url = json['url'].toString();
	}
	if (json['updateContent'] != null) {
		data.updateContent = json['updateContent'].toString();
	}
	if (json['versionName'] != null) {
		data.versionName = json['versionName'].toString();
	}
	if (json['versionCode'] != null) {
		data.versionCode = json['versionCode'] is String
				? int.tryParse(json['versionCode'])
				: json['versionCode'].toInt();
	}
	return data;
}

Map<String, dynamic> appVersionDataToJson(AppVersionData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['url'] = entity.url;
	data['updateContent'] = entity.updateContent;
	data['versionName'] = entity.versionName;
	data['versionCode'] = entity.versionCode;
	return data;
}